package io.gitee.mingbaobaba.apijson.querycondition.query.conditions;

import lombok.Getter;

/**
 * <p>连接条件枚举</p>
 *
 * @author yingsheng.ye
 * @version 1.0.0
 * @since 2023/6/19 21:22
 */
@Getter
public enum EnumKeyword {
    /**
     * 连接条件枚举
     */
    AND("and", "&"),
    OR("or", "|"),
    NOT("not", "!"),
    NULL("is null", ""),
    NOT_NULL("is not null", ""),
    IN("in", "{}"),
    NOT_IN("not in", "!{}"),
    LIKE("like", "$"),
    NOT_LIKE("not like", "!$"),
    EQ("=", ""),
    NE("<>", "!"),
    GT(">", ">"),
    GE(">=", ">="),
    LT("<", "<"),
    LE("<=", "<="),
    REG_EXP("regexp", "~"),
    BETWEEN_AND("between {0} and {1}", "%"),

    /**
     * 函数
     */
    COUNT("count", "count"),
    SUM("sum", "sum"),
    MAX("max", "max"),
    MIN("min", "min"),
    AVG("avg", "avg"),
    GROUP("group", "group"),
    /**
     * 排序
     */
    ORDER_BY("order by", "");

    /**
     * sql关键字
     */
    private final String sqlKeyword;

    /**
     * apiJson关键字
     */
    private final String apiJsonKeyword;

    EnumKeyword(String sqlKeyword, String apiJsonKeyword) {
        this.sqlKeyword = sqlKeyword;
        this.apiJsonKeyword = apiJsonKeyword;
    }
}
